﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Diagnostics;
using Telerik.Windows;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls;
using HeThongThongTin.Library;
using Converter;
using HeThongThongTin.UI.SL.HeThong.HT_VaiTro;
using System.Windows.Threading;
using System.Resources;
using System.Reflection;
using Csla.Xaml;

namespace HeThongThongTin.UI.SL.HeThong.HT_QuanLyVaiTroQuyenHan
{
    public partial class HT_SelectVaiTro_Window : UserControl, Csla.Xaml.ISupportNavigation
    {

        #region ISupportNavigation Members
        List<Control> controls = new List<Control>();
        public bool CreateBookmarkAfterLoadCompleted
        {
            get { return true; }
        }

        public event EventHandler LoadCompleted;

        protected virtual void OnLoadCompleted()
        {
            if (LoadCompleted != null)
                LoadCompleted(this, EventArgs.Empty);
        }

        public void SetParameters(string parameters)
        {
            // no parameters
        }

        public string Title
        {
            get { return "HT_SelectVaiTro_Window"; }
        }

        #endregion

       
        #region Load Methods

        public HT_SelectVaiTro_Window()
        {
            LocalizationConverter converter = new LocalizationConverter();
            converter.LocalResourceManager = new ResourceManager("HeThongThongTin.UI.SL.HeThong.HT_QuanLyVaiTroQuyenHan.Resources", Assembly.GetExecutingAssembly());
            this.Resources.Add("Localization", converter);
            InitializeComponent();
            
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                
                System.Windows.Data.CollectionViewSource ht_VaiTro_ListViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["HT_VaiTro_ListViewModelSource"];
                HT_VaiTro_ListViewModel ht_VaiTro_ListViewModel = new HT_VaiTro_ListViewModel(BusinessConfiguration.Configuration.ComboboxFetchMode);
                ht_VaiTro_ListViewSource.Source = new List<object> { ht_VaiTro_ListViewModel };

            }
        }       
        #endregion

        private void ComboBox_KeyUp(object sender, KeyEventArgs e)
        {
            ControlBehavior.ComboBoxBehaviors.ComboBox_KeyUp(sender, e, controls);
        }

        private void OkItemButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.HT_SelectVaiTro_VaiTroId_ComboBox.SelectedItem != null)
            {
                string parameter = ((HT_VaiTroInfo)this.HT_SelectVaiTro_VaiTroId_ComboBox.SelectedItem).Khoa.ToString();
                Navigator.Current.Navigate("HeThongThongTin.UI.SL.HeThong.HT_QuanLyVaiTroQuyenHan.HT_QuanLyVaiTroQuyenHan_MainWindow,HeThongThongTin.UI.SL", parameter);
            }
        }


       
	}

    
}
